HAL CORTEX NVIC functions migration

Note

The NVIC migration functions are divided according to their ARM Architecture. Each Architecture contains multiple CORTEX versions that are used in your STM32 series.

For example:

  • ARMv8-M: CORTEX-M33 (STM32U5…)

  • ARMv7-M: CORTEX-M7, CORTEX-M4 (STM32H7, STM32L4…)

  • ARMv6-M: CORTEX-M0, CORTEX-M0+ (STM32F0, STM32U0…)

You can find your Series in ST website: Link ( https://www.st.com/en/microcontrollers-microprocessors/stm32-32-bit-arm-cortex-mcus.html)

HAL_NVIC_SetPriorityGrouping

ARM Architecture

HAL1

HAL2

The function HAL_NVIC_SetPriorityGrouping is responsible for setting the priority grouping field for the NVIC (Nested Vectored Interrupt Controller):

This function has been renamed to HAL_CORTEX_NVIC_SetPriorityGrouping:

Functionality Update:

  • Use specific enumeration hal_cortex_nvic_priority_group_t for the priority group parameter, enhancing type safety and clarity.

ARMv8-M, ARMv7-M

void HAL_NVIC_SetPriorityGrouping(uint32_t PriorityGroup)
void HAL_CORTEX_NVIC_SetPriorityGrouping(hal_cortex_nvic_priority_group_t prio_grp)

HAL_NVIC_SetPriority

ARM Architecture

HAL1

HAL2

The function HAL_NVIC_SetPriority is responsible

for setting the priority of an interrupt:

This function has been renamed to HAL_CORTEX_NVIC_SetPriority:

Functionality Update:

  • Use specific enumerations hal_cortex_nvic_preemp_priority_t and hal_cortex_nvic_sub_priority_t for preemption and subpriority parameters, enhancing type safety and clarity.

ARMv8-M, ARMv7-M

void HAL_NVIC_SetPriority(IRQn_Type IRQn,
                          uint32_t PreemptPriority,
                          uint32_t SubPriority)
void HAL_CORTEX_NVIC_SetPriority(IRQn_Type irqn,
                                 hal_cortex_nvic_preemp_priority_t preemp_prio,
                                 hal_cortex_nvic_sub_priority_t sub_prio)

Functionality Update:

  • Remove the PreemptPriority and SubPriority parameters and replace them with one single parameter using specific enumerations`hal_cortex_nvic_priority_t`.

ARMv6-M

void HAL_NVIC_SetPriority(IRQn_Type IRQn,
                          uint32_t PreemptPriority,
                          uint32_t SubPriority)
void HAL_CORTEX_NVIC_SetPriority(IRQn_Type irqn,
                                 hal_cortex_nvic_priority_t prio)

HAL_NVIC_EnableIRQ

ARM Architecture

HAL1

HAL2

The function HAL_NVIC_EnableIRQ is responsible for enabling a device-specific interrupt in the NVIC (Nested Vectored Interrupt Controller):

This function has been renamed to HAL_CORTEX_NVIC_EnableIRQ:

All Architectures

void HAL_NVIC_EnableIRQ(IRQn_Type IRQn)
void HAL_CORTEX_NVIC_EnableIRQ(IRQn_Type irqn)
Related use cases:

HAL_NVIC_DisableIRQ

ARM Architecture

HAL1

HAL2

The function HAL_NVIC_DisableIRQ is responsible for disabling a device-specific interrupt in the NVIC (Nested Vectored Interrupt Controller):

This function has been renamed to HAL_CORTEX_NVIC_DisableIRQ:

All Architectures

void HAL_NVIC_DisableIRQ(IRQn_Type IRQn)
void HAL_CORTEX_NVIC_DisableIRQ(IRQn_Type irqn)

HAL_NVIC_SystemReset

ARM Architecture

HAL1

HAL2

The function HAL_NVIC_SystemReset is responsible for resetting the system:

This function has been renamed to HAL_CORTEX_NVIC_SystemReset:

All Architectures

void HAL_NVIC_SystemReset(void)
void HAL_CORTEX_NVIC_SystemReset(void)

HAL_NVIC_GetPriorityGrouping

ARM Architecture

HAL1

HAL2

The function HAL_NVIC_GetPriorityGrouping is responsible for retrieving the priority grouping field from the NVIC (Nested Vectored Interrupt Controller)

This function has been updated and renamed to HAL_CORTEX_NVIC_GetPriorityGrouping:

Functionality Update:

  • Return the priority grouping as an enumeration hal_cortex_nvic_priority_group_t, enhancing type safety and clarity.

ARMv8-M, ARMv7-M

uint32_t HAL_NVIC_GetPriorityGrouping(void)
hal_cortex_nvic_priority_group_t HAL_CORTEX_NVIC_GetPriorityGrouping(void)

HAL_NVIC_GetPriority

ARM Architecture

HAL1

HAL2

The function HAL_NVIC_GetPriority is responsible for retrieving the priority of an interrupt:

This function has been updated and renamed to HAL_CORTEX_NVIC_GetPriority:

Functionality Update:

  • Use specific enumerations hal_cortex_nvic_preemp_priority_t and hal_cortex_nvic_sub_priority_t for preemption and subpriority parameters, enhancing type safety and clarity.

ARMv8-M, ARMv7-M

void HAL_NVIC_GetPriority(IRQn_Type IRQn,
                          uint32_t PriorityGroup,
                          uint32_t *const pPreemptPriority,
                          uint32_t *const pSubPriority)
void HAL_CORTEX_NVIC_GetPriority(IRQn_Type irqn,
                                 hal_cortex_nvic_preemp_priority_t *p_preemp_prio,
                                 hal_cortex_nvic_sub_priority_t *p_sub_prio)

ARMv6-M

void HAL_NVIC_GetPriority(IRQn_Type IRQn)
void HAL_CORTEX_NVIC_GetPriority(IRQn_Type irqn)

HAL_NVIC_GetPendingIRQ

ARM Architecture

HAL1

HAL2

The function HAL_NVIC_GetPendingIRQ is responsible for retrieving the pending status of an interrupt:

This function has been updated and renamed to HAL_CORTEX_NVIC_IsPendingIRQ:

Functionality Update:

  • Return the pending status as an enumeration hal_cortex_nvic_irq_pending_state_t, enhancing type safety and clarity.

All Architectures

uint32_t HAL_NVIC_GetPendingIRQ(IRQn_Type IRQn)
hal_cortex_nvic_irq_pending_status_t HAL_CORTEX_NVIC_IsPendingIRQ(IRQn_Type irqn)

HAL_NVIC_SetPendingIRQ

ARM Architecture

HAL1

HAL2

The function HAL_NVIC_SetPendingIRQ is responsible for setting the pending status of an interrupt:

This function has been renamed to HAL_CORTEX_NVIC_SetPendingIRQ:

All Architectures

void HAL_NVIC_SetPendingIRQ(IRQn_Type IRQn)
void HAL_CORTEX_NVIC_SetPendingIRQ(IRQn_Type irqn)

HAL_NVIC_ClearPendingIRQ

ARM Architecture

HAL1

HAL2

The function HAL_NVIC_ClearPendingIRQ is responsible for clearing the pending status of an interrupt:

This function has been renamed to HAL_CORTEX_NVIC_ClearPendingIRQ:

All Architectures

void HAL_NVIC_ClearPendingIRQ(IRQn_Type IRQn)
void HAL_CORTEX_NVIC_ClearPendingIRQ(IRQn_Type irqn)

HAL_NVIC_GetActive

ARM Architecture

HAL1

HAL2

The function HAL_NVIC_GetActive is responsible for retrieving the active status of an interrupt:

This function has been updated and renamed to HAL_CORTEX_NVIC_IsActiveIRQ:

Functionality Update:

  • Return the active status as an enumeration hal_cortex_nvic_irq_active_state_t, enhancing type safety and clarity.

ARMv8-M, ARMv7-M

uint32_t HAL_NVIC_GetActive(IRQn_Type IRQn)
hal_cortex_nvic_irq_active_status_t HAL_CORTEX_NVIC_IsActiveIRQ(IRQn_Type irqn)